import axios from 'axios'
import config from './config'
//登录验证
function login(id, paw) {
    return axios({
        method: 'post',
        baseURL: config.host,
        url: '/login',
        data: {
            user_id: id,
            password: paw
        }
    });
}

//注册请求
function enroll(id,paw,n) {
    return axios({
        method: 'post',
        baseURL: config.host,
        url: '/enroll',
        data: {
            studentNumber: id,
            password: paw,
            name:n
        }
    });
}

//获取用户信息
function getUser(id) {
    return axios({
        method: 'GET',
        baseURL: config.host,
        url: '/users',
        params:{
            id
        }
    })
}

//更新用户数据

function upUser(data) {
    return axios({
        method: 'post',
        baseURL: config.host,
        url: '/users/update',
        data
    });
}

export {
    login,
    enroll,
    getUser,
    upUser
}